package com.ruoyi.web.xxj.service.impl;

import java.math.BigDecimal;
import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.web.xxj.domain.RefundInfo;
import com.ruoyi.web.xxj.domain.vo.EachMonthSumObj;
import com.ruoyi.web.xxj.domain.vo.RefundInfoVo;
import com.ruoyi.web.xxj.mapper.RefundInfoMapper;
import com.ruoyi.web.xxj.service.IRefundInfoService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 退款记录Service业务层处理
 *
 * @author ruoyi
 * @date 2024-01-28
 */
@Service
public class RefundInfoServiceImpl implements IRefundInfoService {
    @Autowired
    private RefundInfoMapper refundInfoMapper;

    /**
     * 查询退款记录
     *
     * @param id 退款记录主键
     * @return 退款记录
     */
    @Override
    public RefundInfoVo selectRefundInfoById(Long id) {
        return refundInfoMapper.selectRefundInfoById(id);
    }

    /**
     * 查询退款记录列表
     *
     * @param refundInfo 退款记录
     * @return 退款记录
     */
    @Override
    public List<RefundInfoVo> selectRefundInfoList(RefundInfo refundInfo) {
        return refundInfoMapper.selectRefundInfoList(refundInfo);
    }

    /**
     * 新增退款记录
     *
     * @param refundInfo 退款记录
     * @return 结果
     */
    @Override
    public int insertRefundInfo(RefundInfo refundInfo) {
        refundInfo.setCreateTime(DateUtils.getNowDate());
        return refundInfoMapper.insertRefundInfo(refundInfo);
    }

    /**
     * 修改退款记录
     *
     * @param refundInfo 退款记录
     * @return 结果
     */
    @Override
    public int updateRefundInfo(RefundInfo refundInfo) {
        refundInfo.setUpdateTime(DateUtils.getNowDate());
        return refundInfoMapper.updateRefundInfo(refundInfo);
    }

    /**
     * 批量删除退款记录
     *
     * @param ids 需要删除的退款记录主键
     * @return 结果
     */
    @Override
    public int deleteRefundInfoByIds(Long[] ids) {
        return refundInfoMapper.deleteRefundInfoByIds(ids);
    }

    /**
     * 删除退款记录信息
     *
     * @param id 退款记录主键
     * @return 结果
     */
    @Override
    public int deleteRefundInfoById(Long id) {
        return refundInfoMapper.deleteRefundInfoById(id);
    }

    @Override
    public BigDecimal getToYearRefund() {
        return refundInfoMapper.getToYearRefund();
    }

    @Override
    public List<EachMonthSumObj> getEachMonthRefund(String type) {
        return refundInfoMapper.getEachMonthRefund(type);
    }
}
